﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace KBEngine.Extension
{
    public class ProfileConsole : TelnetConsole
    {
        private string _command;
        private string _sec;
        private string _password;
        public ProfileConsole(ITelnet wsInst, IPAddress host, ulong port, string command, string sec, string password) : base(wsInst, host, port)
        {
            _command = command;
            _sec = sec;
            _password = password;
        }

        protected override void onConnectedToConsole()
        {
            onReceivedClientData(_password);
            onReceivedClientData(_command + " " + _sec);
        }
        protected override bool onReceivedClientData(string data)
        {
            if (data == ":")
            {
                Close();
                return false;
            }
            if (!_telnet.Connected) return false;
            _waitSend.Enqueue(_pre_process_cmd(data));
            return true;
        }
    }
}
